package cn.wolfcode.crm.web.controller;


import cn.wolfcode.crm.ann.PermissionName;
import cn.wolfcode.crm.domain.PayPoints;
import cn.wolfcode.crm.service.IPayPointsService;
import cn.wolfcode.crm.util.JsonResult;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

//积分管理的积分变动
@Controller
@RequestMapping("pay")
public class PayPointsController {

    @Autowired
    private IPayPointsService payPointsService;
    @RequestMapping("s")
    public String s() {
        return "redirect:/static/manage/pay.jsp";
    }


    @RequestMapping("")
    public String index() {


        return "manage/pay";
    }

    @RequestMapping("save")
    @ResponseBody
    public JsonResult insert(PayPoints payPoints) {
        JsonResult jsonResult = new JsonResult();
        try {
            payPointsService.insert(payPoints);
        } catch (Exception e) {
            e.printStackTrace();
            jsonResult = new JsonResult();
        }
        return jsonResult;
    }
    @RequestMapping("update")
    @ResponseBody
    public JsonResult update(PayPoints payPoints) {
        JsonResult jsonResult = new JsonResult();
        try {
            payPointsService.updateByPrimaryKey(payPoints);
        } catch (Exception e) {
            e.printStackTrace();
            jsonResult = new JsonResult();
        }
        return jsonResult;
    }

}
